package edu.uta.iconverter.converter;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


public class Dictionary {
    public HashMap<String, String> loadDictionaryFromFile(String filename) throws FileNotFoundException, IOException{
        HashMap<String, String> dictionary = new HashMap<String, String>();
        BufferedReader bufferReader = new BufferedReader(new FileReader("resources/Dictionary.txt"));                     
                       
        String line = "";
        
        while( (line = bufferReader.readLine()) != null){
            String javaSyntax = line;
            String cSharpSyntax = bufferReader.readLine();
            dictionary.put(javaSyntax, cSharpSyntax);
        }
       
        //System.out.println("Size -->>> "+dictionary.size());

        bufferReader.close();
        return dictionary;
    } 
    
    public String[] loadDictionaryWordsFromFile(String filename) throws FileNotFoundException, IOException{
        
        BufferedReader bufferReader = new BufferedReader(new FileReader("resources/Dictionary.txt"));                     
                       
        String line = "";
        StringBuffer feeder = new StringBuffer();
        while( (line = bufferReader.readLine()) != null){
            String javaSyntax = line;
            String cSharpSyntax = bufferReader.readLine();
            feeder.append(javaSyntax+",");
        }
       
        //System.out.println("Size -->>> "+dictionary.size());

        bufferReader.close();
        
        String[] loader = (feeder.toString()).split(",");

        return loader;
    } 
}

